<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    *{
      padding:0;
      margin:0;
    }
    /* 问题：外边距重叠   top跟bottom相距20px*/
   
    .top{
      width:100px;
      height:100px;
      background-color: pink;     
      margin-bottom: 20px;
      
    }
    .bottom{                            /* 正正取最大；负负去最小；正负去和*/
      width:100px;
      height:100px;
      background-color: red;
      margin-top: 10px;
    }
  </style>
</head>
<body>

  <div class="top"></div>
  <div class="bottom"></div>

</body>
</html>